<!--
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
    file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<!--
    Copyright (c) 2014, Joyent, Inc.
-->

<div class="status {{status}}"></div>

<div class="name">
  <a href="/servers/{{uuid}}">{{hostname}}</a>
  {{#if reserved}}
  <span class="reserved"><i class="fa fa-lock"></i></span>
  {{/if}}
  <span class="uuid"><span class="selectable">{{uuid}}</span></span>
  <div class="traits">
    {{#if headnode}}
    <span class="headnode">HEADNODE</span>
    {{/if}}
    {{#if traits.ssd}}
    <span class="ssd">SSD</span>
    {{/if}}
    {{#if traits.manta}}
    <span class="manta">MANTA</span>
    {{/if}}
    {{#if traits.customer}}
    <span class="customer">CUSTOMER</span>
    {{/if}}
  </div>
</div>

{{#if setup}}
<div class="memory-usage">
  <div class="memory-usage-avail">
    <strong>Provisionable</strong>
    <span class="avail
    {{#unless memory_provisionable_percent}}
    full
    {{/unless}}
    ">{{memory_provisionable_gb}} GB</span>
  </div>
  <div class="memory-usage-graph"></div>
  <div class="memory-usage-total">
    <strong>Total</strong>
    <span class="total">{{memory_total_gb}} GB</span>
  </div>
</div>
</div>

{{else}}

<div class="setup-status">
  {{#if not_setup}}
    {{#if setting_up}}
    Setting up
    {{else}}

    {{#role "operators"}}
    <small class="requires-setup">Requires Setup</small>
    <button class="setup btn btn-info btn-sm setup"><i class="fa fa-magic"></i> Setup this Server</button>
    {{/role}}
    {{/if}}
  {{/if}}
</div>

{{/if}}

<div class="last-status">
  <div class="last-platform">
    <strong><i class="fa fa-fw fa-location-arrow"></i></strong>
    <span>{{current_platform}}</span>
  </div>

  <div class="last-boot">
    <strong><i class="fa fa-fw fa-power-off"></i></strong> <span>{{last_boot}}</span>
  </div>
  <div class="last-heartbeat">
    <strong><i class="fa fa-fw fa-heart"></i></strong> <span>{{last_heartbeat}}</span></div>
  </div>
</div>
